package com.qf.boot2202day03.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

//@Component
//@Aspect    // 切面注解
public class MyAspect {

    @Pointcut("execution(* com.qf.boot2202day03.controller..*.*(..))")
    public void mypointcut(){ }


    @Before("mypointcut()")
    public void before(){
        System.out.println("================before================");
    }

    @Around("mypointcut()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {

        System.out.println("------------aroud 前置---------------");

        final Object result = pjp.proceed();

        System.out.println("------------aroud 后置---------------");

        return result;

    }

    @After("mypointcut()")
    public void after(){
        System.out.println("================after================");
    }

}
